<template>
  <ContentWrap>
    <!-- 搜索工作栏 -->
    <el-form
      class="-mb-15px"
      :model="queryParams"
      ref="queryFormRef"
      :inline="true"
      label-width="68px"
    >
      <el-form-item label="人名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入人名"
          clearable
          @keyup.enter="handleQuery"
          class="!w-240px"
        />
      </el-form-item>
      <el-form-item>
        <el-button @click="handleQuery">
          <Icon icon="ep:search" class="mr-5px" />
          搜索
        </el-button>
        <el-button @click="resetQuery">
          <Icon icon="ep:refresh" class="mr-5px" />
          重置
        </el-button>
        <el-button @click="resetQuery" type="success"> 实体对齐 </el-button>
      </el-form-item>
    </el-form>
  </ContentWrap>

  <!-- 列表 -->
  <ContentWrap>
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
      <el-table-column align="center" label="名称" fixed="left" prop="name" />
      <el-table-column align="center" label="行政区类别" fixed="left" prop="type" />
      <el-table-column align="center" label="别名" fixed="left" prop="bName" />
      <el-table-column align="center" label="所属地区" fixed="left" prop="place" />
      <el-table-column align="center" prop="status" label="状态">
        <template #default="scope">
          <dict-tag :type="DICT_TYPE.ENTITY_STATUS" :value="scope.row.status" />
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" fixed="right" width="200">
        <template #default="scope">
          <div class="flex items-center justify-center">
            <el-button type="primary" link @click="openForm('update', scope.row.id)">
              <Icon icon="ep:edit" />
              修改
            </el-button>
            <el-dropdown @command="(command) => handleCommand(command, scope.row)">
              <el-button type="primary" link>
                <Icon icon="ep:d-arrow-right" />
                更多
              </el-button>
              <template #dropdown>
                <el-dropdown-menu>
                  <el-dropdown-item command="handleIndex">
                    <Icon icon="ep:link" />
                    关系标引
                  </el-dropdown-item>
                  <el-dropdown-item command="handleDelete">
                    <Icon icon="ep:delete" />
                    删除
                  </el-dropdown-item>
                  <el-dropdown-item command="handleStart">
                    <Icon icon="ep:check" />
                    启用
                  </el-dropdown-item>
                  <el-dropdown-item command="handleStop">
                    <Icon icon="fa-solid:stop-circle" />
                    停用
                  </el-dropdown-item>
                </el-dropdown-menu>
              </template>
            </el-dropdown>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <Pagination
      :total="total"
      v-model:page="queryParams.pageNo"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />
  </ContentWrap>
</template>

<script lang="ts" setup>
import { DICT_TYPE } from '@/utils/dict'
import router from '@/router'

defineOptions({ name: 'KBasePlace' })

const message = useMessage() // 消息弹窗
const { t } = useI18n() // 国际化

/** 操作分发 */
const handleCommand = (command: string, row) => {
  switch (command) {
    case 'handleDelete':
      break
    case 'handleResetPwd':
      break
    case 'handleStop':
      break
    case 'handleStart':
      break
    default:
      break
  }
}

const loading = ref(false)
const total = ref(0)
const list = ref([
  {
    name: '全州',
    type: '县',
    bName: '全县，湘源县，桂北县',
    place: '广西壮族自治区桂林市',
    status: '2'
  }
]) // 列表的数据
const queryParams = reactive({
  pageNo: 1,
  pageSize: 10,
  name: undefined
})
const getList = () => {}
const handleQuery = () => {
  getList()
}

const resetQuery = () => {
  getList()
}

//抽取
const extract = (row) => {
  if (row.status == 1 || row.status == 1) {
    message.error('已抽取')
    return
  } else {
    message.success('系统正在进行抽取，请稍等。')
  }
}

const check = (bookId) => {
  router.push({ path: '/kg/process/check' })
}
</script>

<style scoped></style>
